/*
    YmsgIRC - Program enabling YMSG chat clients to use IRC
    Copyright (C) 2011 Crash Daemonicus ( crashenator -at- gmail.com )

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include "ChatRenderer.h"

string RendererText_StripText(const string& s)
{   dbg_head("YMSG::StripText(const string& s)");
    #ifdef _WIN32
        void* p=RendererText_Create(s.c_str());
        RendererText_YFormatHTML(p);
        RendererText_HTMLStripFormatting(p);
        const char* cs=RendererText_Retrieve(p);
		printf("%d - %s\n",strlen(cs),cs);
		string s2(cs);
		delstr(&cs);//*** FIX: should be able to delete the generated string, but trying to gives an exception.


        RendererText_Dispose(p);
        //return so;
        
        
        
        stringreplace(s2, "&lt;", "<");
        stringreplace(s2, "&gt;", ">");
        stringreplace(s2, "&amp;","&");
        
        ReturnD(s2);
        
        
    #else
        puts("Warning: StripText not yet supported in non-windows environments.");
        ReturnD(s);
    #endif
}
